<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <f:metadata>
            <f:viewParam name="serviceID" value="#{serviceBean.serviceID}"/>
            <f:event type="preRenderView" listener="#{serviceBean.getServiceDetail}"/>
        </f:metadata>  
    </h:head>
    <h:body>
        <ui:composition template="template/masterlayout.xhtml">
            <ui:define name="pagetitle">
                Edit service #{serviceBean.serviceName}
            </ui:define>
            <ui:define name="breadcrumb">
                <h:link value="Dashboard" outcome="index"/> &raquo; <h:link value="Services management" outcome="services"/> &raquo; <h:outputText value="Edit : #{serviceBean.serviceName}"/>
            </ui:define>
            <ui:define name="content">
                <h:form styleClass="jNice">
                    <fieldset>
                        <p>
                            <h:outputLabel for="serviceName">Service Name:</h:outputLabel>
                            <h:inputText id="serviceName" value="#{serviceBean.serviceName}" required="true"
                                         requiredMessage="#{msgs.Service_NameRequire}" validatorMessage="#{msgs.Service_NameLeght}"
                                         >
                                <f:validateLength minimum="3" maximum="30"/>
                            </h:inputText>
                            <h:message for="serviceName" styleClass="error"/>
                        </p>
                        <p>
                            <h:outputLabel for="servicePrice">Service Price:</h:outputLabel>
                            <h:inputText id="servicePrice" value="#{serviceBean.servicePrice}" converterMessage="#{msgs.Service_ServicePrice}" >
                                <f:convertNumber />
                            </h:inputText>  
                            <h:message for="servicePrice" styleClass="error"/>
                        </p>    
                        <p>
                            <h:outputLabel for="serviceDescription">Service Description:</h:outputLabel>
                            <h:inputTextarea id="serviceDescription" value="#{serviceBean.serviceDescription}"/>                             
                        </p>    
                        <p>
                            <h:inputHidden value="#{serviceBean.serviceID}" id="serviceId" />
                            <h:commandButton value="Update" action="#{serviceBean.editService()}"/>
                        </p>
                    </fieldset>
                </h:form>                  
            </ui:define>
        </ui:composition>
    </h:body>
</html>

